import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect:'/films/nowPlaying'
  },
  {
    path: '/films',
    name: 'films',
    component: () => import('../views/Films.vue'),
    children:[
      {
        path:'nowPlaying',
        component:()=>import('../views/NowPlaying.vue')
      },
      {
        path:'comingSoon',
        component:()=>import('../views/ComingSoon.vue')
      }
    ]
  },
  {
    path:'/films/:id',
    name:'detail',
    component:()=>import('../views/MovieDetail.vue')
  },
  {
    path:'/city',
    component:()=>import('../views/City.vue')
  }
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
